package observer.practice_03;

import org.apache.log4j.Logger;

/**
 * @author yi qiang
 * @date 2021/11/4 2:06
 */
public class Context {

    private Context(){}

    private static final Logger log = Logger.getLogger(Context.class);

    private static final PaySubject PAY_SUBJECT = new PaySubject();

    static {
        RedisObserver redisObserver = new RedisObserver();
        MongoObserver mongoObserver = new MongoObserver();
        PAY_SUBJECT.register(redisObserver);
        PAY_SUBJECT.register(mongoObserver);
    }


    public static PaySubject getPaySubject() {
        log.info(PAY_SUBJECT.getObservers());
        return PAY_SUBJECT;
    }
}
